#ifndef _ZKSWE_UTILS_LOG_H_
#define _ZKSWE_UTILS_LOG_H_

#include <stdio.h>
#include <stdlib.h>

#ifdef USE_ANDROID_LOG
#include <android/log.h>

#define LOG_TAG "zkgui"
#define LOGE(...)	__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGD(...)	__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#else
#define LOGE(...)	printf(__VA_ARGS__)
#define LOGD(...)	printf(__VA_ARGS__)
#endif

#include <sys/time.h>
#include <stdint.h>

uint64_t getCurrentTime() {
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return (((uint64_t) tv.tv_sec * 1000000LL) + (tv.tv_usec));
}

static uint64_t sStartTime;

static void logBegin(const char *pTag) {
	LOGD("%s log begin\n", pTag);
	sStartTime = getCurrentTime();
}

static void logEnd(const char *pTag) {
	LOGD("%s take time: %dus\n", pTag, (int) (getCurrentTime() - sStartTime));
}

#endif /* _ZKSWE_UTILS_LOG_H_ */
